package com.wechatnotice.wechatnotice.utils;

import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

import java.util.Map;

/**
 * <p>
 *
 * </p>
 *
 * @program: WechatNotice
 * @author: daPangDong
 * @create: 2022-10-28 09:56
 */
@Configuration
@RequiredArgsConstructor
public class NoticeClient {

    private static final String WE_CHAT_URL ="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=";

    /**
     * 本地
     */
    private final String url = WE_CHAT_URL+"da4e5c5c-46c3-4af9-8da8-70790d0bba71";
    /**
     * 测试环境
     */
    private final String urlTwo = WE_CHAT_URL+"25a6f608-56e5-4a18-986b-a1bc81ddd08e";

    private final RestTemplate restTemplate;

    public ResponseEntity<Map> weChatNotice(String keyValue,Map<String,Object> bodys){
        return restTemplate.postForEntity(
                url,
                bodys,
                Map.class);
    }
}
